def run(params:list[str]):
    from ApiTools import apiBase,apiTools
    from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
    try:         
        sys_prompt = apiBase.argv_json(params,1,'''[{"role": "system", "content": "You are a Postgresql database expert"},
            {"role": "user","content":"{sql}:{ddl}"} ]''')
        quest = apiBase.argv_json(params,2,'{"sql":"sql","ddl":"ddl"}')

        lsTmpl=[]
        for obj in sys_prompt:
            if "system" == obj["role"]:
                lsTmpl.append( ('system',obj["content"] ) )
            if "user" == obj["role"]:
                lsTmpl.append( ('user',obj["content"] ) )
            if "human" == obj["role"]:
                lsTmpl.append( ('human',obj["content"] ) )
            if "assistant" == obj["role"]:
                lsTmpl.append( ('ai',obj["content"] ) )
            if "ai" == obj["role"]:
                lsTmpl.append( ('ai',obj["content"] ) )
        prompt_template = ChatPromptTemplate.from_messages(lsTmpl)                
        initial_answer_chain = prompt_template | apiTools.llm
        res = initial_answer_chain.invoke(quest)
        return res.content
    except Exception as e:
        return f"function error:{e}"

#run([])